<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>flex</title>
</head>

<style>
    div {
        display: flex;
        width: 800px;
        height: 200px;
        background-color: pink;
    }
    div>span{
        width: 40px;
        height: 40px;
        background-color: skyblue;
    }

    p {
        display: flex;
        width: 100%;
        height: 300px;
        background-color: pink;
        margin: 100px auto;
    }

    p>span {
        flex: 1;
        height: 30px;
        background-color: skyblue;
        border: 1px solid #fff;
    }

    p>span:nth-child(1){
        flex: 2;
    }

    /* 头部标签置顶并固定 */
    .search-index {
        position: fixed;
        top: 0;
        /* 注意居中的写法 */
        left: 50% ;
        transform: translateX(-50%);

        height: 40px;
        width: 100%;
        max-width: 640px;
        background-color: pink;
    }
</style>
<body>
    
    <div><span>1</span><span>2</span><span>3</span></div>


    <br>
    <p>
        <span>1</span>
        <span>2</span>
        <span>3</span>
    </p>
    <br>
    <div class="search-index">

    </div>

</body>
</html>